package com.xltt.vehicleControl.bean;

/**
 * @author zhaotengfei
 * @version 1.0.0
 * @created 2017/4/20 19:21
 */

import java.io.Serializable;

public class ServiceResult extends BaseResponse implements Serializable {
    private int operationResult = -1;
    private Error error;
    public static final int RESULT_SUCCESS = 0;
    public static final int RESULT_SUBMIT = 1;
    public static final int RESULT_FAILURE = 2;
    public static final int RESULT_SENT_TO_TEM = 3;
    public static final int RESULT_ENGINE_START = 4;
    public static final int RESULT_ENGINE_STOP = 5;
    public static final int RESULT_DIAGNOSTICS_STATUS = 6;
    public static final int RESULT_ACTIVE = 8;
    public static final int RESULT_POI = 9;
    public static final int RESULT_FRIENDS = 11;
    public static final int RESULT_CAR_BIND = 12;
    public static final int RESULT_PM25 = 14;
    public static final int RESULT_CHARGE = 16;
    public static final int RESULT_UPDATE_STATUS = 15;
    public static final int RESULT_OTHER_DEVICE = 18;//账号异地登录
    public static final int RESULT_ACHIEVEMENT = 19;//
    public static final int RESULT_CANCEL_FRIENDS = 20;

    public ServiceResult() {
    }

    public void setOperationResult(int operationResult) {
        this.operationResult = operationResult;
    }

    public void setError(Error error) {
        this.error = error;
    }

    public int getOperationResult() {
        return this.operationResult;
    }

    public Error getError() {
        return this.error;
    }

    public boolean isSentToTEM() {
        return this.operationResult == 3;
    }

    public boolean isSubmit() {
        return this.operationResult == 1;
    }

    public boolean isSuccess() {
        return this.operationResult == 0;
    }

    public boolean isFailure() {
        return this.operationResult == 2;
    }

    public boolean isEngineStart() {
        return this.operationResult == RESULT_ENGINE_START;
    }

    public boolean isEngineStop() {
        return this.operationResult == RESULT_ENGINE_STOP;
    }

    public boolean isDiagnostics() {
        return this.operationResult == 6;
    }

    public boolean isTokenUnavailable() {
        return this.error != null && this.isInvalidCode(this.error.getCode());
    }

    public int describeContents() {
        return 0;
    }




}

